#include <iostream>
using std::cout;
using std::endl;

class Point{
public:
    Point(int x, int y)
    :_x(x)
    ,_y(y)
    ,_z(_x)// int & _z = _x;
    {

    }

    void print(){
        cout << _x << "," << _y << "," << _z << endl;
    }

private:
    int _x;
    int _y;
    int & _z;//需要绑定到一个变量
             //绑定的变量的生命周期要不短于该引用的生命周期
};


void test(){
    int a = 1, b = 2, c = 3;
    Point pt(a, b, c);
    pt.print();
}

int main()
{
    test();
    return 0;
}

